package com.ym.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {

    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() {
        Config config = new Config();

        // 设置 Redis 服务器地址
        config.useSingleServer()
                .setAddress("redis://192.168.40.130:6379");
        //看门狗每次增加时间30秒
        config.setLockWatchdogTimeout(20000);

        return Redisson.create(config);
    }
}
